//
// Built on Thu Sep 17 07:24:36 CEST 2015 by logback-translator
// For more information on configuration files in Groovy
// please see http://logback.qos.ch/manual/groovy.html

// For assistance related to this tool or configuration files
// in general, please contact the logback user mailing list at
//    http://qos.ch/mailman/listinfo/logback-user

// For professional support please see
//   http://www.qos.ch/shop/products/professionalSupport

import ch.qos.logback.classic.PatternLayout
import ch.qos.logback.classic.encoder.PatternLayoutEncoder
import ch.qos.logback.classic.filter.ThresholdFilter
import ch.qos.logback.core.ConsoleAppender
import ch.qos.logback.core.rolling.RollingFileAppender
import ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP
import ch.qos.logback.core.rolling.TimeBasedRollingPolicy

import static ch.qos.logback.classic.Level.DEBUG
import static ch.qos.logback.classic.Level.INFO

scan("60 seconds")
def projectName = "cloudteach-service"
context.name = "${projectName}"
appender("CONSOLE", ConsoleAppender) {
    filter(ThresholdFilter) {
        level = DEBUG
    }
    encoder(PatternLayoutEncoder) {
        pattern = "[logback] %-5level %d{MMdd HH:mm:ss} \\(%F:%L\\) %method\\(\\) - %m%n"
    }
}
appender("FILE", RollingFileAppender) {
    file = "logback/service/${projectName}.log"
    encoding = "UTF-8"
    rollingPolicy(TimeBasedRollingPolicy) {
        fileNamePattern = "logback/service/${projectName}.%d{yyyy-MM-dd}.%i.log"
        maxHistory = 30
        timeBasedFileNamingAndTriggeringPolicy(SizeAndTimeBasedFNATP) {
            maxFileSize = "100MB"
        }
    }
    layout(PatternLayout) {
        pattern = "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n"
    }
}
logger("com.apache.ibatis", DEBUG)
logger("java.sql.Statement", DEBUG)
logger("java.sql.PreparedStatement", DEBUG)
logger("java.sql.ResultSet", DEBUG)
root(DEBUG, ["FILE", "CONSOLE"])